{include file=comm/head.html}
<div class="contact-page">
    <div class="sub-banner">
        <div class="mask">
            <div class="p-title">Contact Us</div>
        </div>
        <div class="pic">
            <img class="needImgScale" src="{pboot:sitetplpath}/images/contact_banner.png" alt="">
        </div>
    </div>
    <section class="section-2">
        <main>
            <div class="main">
                <div class="left">
                    <div class="t1">keep in</div>
                    <div class="t2">touch</div>
                    <div class="t3">Welcome new and old customers to call and write to negotiate orders!</div>
                </div>
                <div class="right">
                    <input type="text" name="contacts" required id="contacts" class="form-control" placeholder="Name">


                    <input type="text" name="mobile" required id="mobile" class="form-control" placeholder="Phone number / Email">


                    <textarea name="content" id="content" class="form-control" placeholder="Content"></textarea>

                    {pboot:if({pboot:msgcodestatus})}
                    <div class="check">
                        <img title="click to refresh" class="codeimg" style="height:56px;" src="{pboot:checkcode}" onclick="this.src='{pboot:checkcode}?'+Math.round(Math.random()*10);" />
                        <input type="text" name="checkcode" required id="checkcode" class="form-control" placeholder="Please enter the verification code">
                    </div>
                    {/pboot:if}
                    <div style="width: 432px;">
                        <div class="submit" onclick="submsg(this)">Submit</div>
                    </div>
                </div>
            </div>

        </main>
    </section>
    <div class="map">
        <main>
            <div class="map-dialog">
                <div class="left-part">
                    <div class="item ">
                        <div class="icon">
                            <img src="{pboot:sitetplpath}/images/home_icon.png" alt="" class="icon">
                        </div>
                        <div class="value">{pboot:companyaddress}</div>
                    </div>
                    <div class="item address">
                        <div class="icon">
                            <img src="{pboot:sitetplpath}/images/phone_icon.png" alt="" class="icon">
                        </div>
                        <div class="value">{pboot:companymobile}</div>
                    </div>
                </div>
                <div class="right-part">
                    <div class="qr">
                        <img src="{pboot:companywhatsapp}" alt="whatsApp" />
                        <div class="text">Whatsapp</div>
                    </div>
                    <div class="qr">
                        <img src="{pboot:companyweixin}" alt="weChat">
                        <div class="text">Wechat</div>
                    </div>
                </div>
            </div>
            <div class="map-dialog map-dialog2">
                <div class="left-part">
                    <div class="item ">
                        <div class="icon">
                            <img src="{pboot:sitetplpath}/images/home_icon.png" alt="" class="icon">
                        </div>
                        <div class="value">{pboot:companyaddress}</div>
                    </div>
                    <div class="item address">
                        <div class="icon">
                            <img src="{pboot:sitetplpath}/images/phone_icon.png" alt="" class="icon">
                        </div>
                        <div class="value">{pboot:companymobile}</div>
                    </div>
                </div>
                <div class="right-part">
                    <div class="qr">
                        <img src="{pboot:companywhatsapp}" alt="whatsApp" />
                        <div class="text">Whatsapp</div>
                    </div>
                    <div class="qr">
                        <img src="{pboot:companyweixin}" alt="weChat">
                        <div class="text">Wechat</div>
                    </div>
                </div>
            </div>
        </main>

        <div id="container"></div>
    </div>
</div>
<script src="https://webapi.amap.com/maps?v=1.4.5&key=c18178886fa9ec63d66e17d0f6b08ac3"></script>

{include file=comm/foot.html}
<script>
    var map;
    function mapInit(){
        map = new AMap.Map('container', {
            zoom: 17,
            zooms: [2, 20],
            center: [119.79,31.95],
            lang: "en", //可选值：en，zh_en, zh_cn
            mapStyle: "amap://styles/whitesmoke",
        });
        const marker = new AMap.Marker({
            position: [119.79,31.95], //位置
        });
        map.add(marker); //添加到地图
    }
    function mapInit2(){
        map = new AMap.Map('container', {
            zoom: 17,
            zooms: [2, 20],
            center: [117.12,39.13],
            lang: "en", //可选值：en，zh_en, zh_cn
            mapStyle: "amap://styles/whitesmoke",
        });
        const marker = new AMap.Marker({
            position: [117.12,39.13], //位置
        });
        map.add(marker); //添加到地图
    }
    mapInit()
    function submsg(obj){
        var url='{pboot:msgaction}';
        var contacts=$("#contacts").val();
        var mobile=$("#mobile").val();
        var content=$("#content").val();
        var checkcode=$("#checkcode").val();
        $.ajax({
            type: 'POST',
            url: url,
            dataType: 'json',
            data: {
                contacts: contacts,
                mobile: mobile,
                content: content,
                checkcode: checkcode
            },
            success: function (response, status) {
                if(response.code){
                    alert("Thank You!!");
                    $("#contacts").val('')
                    $("#mobile").val('')
                    $("#content").val('')
                    $("#checkcode").val('')
                }else{
                    alert(response.data);
                    $('.codeimg').click();//更新验证码
                }
            },
            error:function(xhr,status,error){
                alert('error');
            }
        });
        return false;
    }

    $(window).load(function () {

    });
</script>
